package com.iskny.framework.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.jfinal.kit.JsonKit;

public class MenuBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 574973634592094319L;
	Long id;//id
	Long pid;//pid
	String name;//名称
	String url;//登录类型
	String opentype ;//打开方式
	private List<MenuBean> children = new ArrayList<MenuBean>();
	public MenuBean(Menu menu){
		id = menu.getLong("id");
		pid = menu.getLong("pid");
		name = menu.getStr("name");
		url = menu.getStr("url");
		opentype = menu.getStr("opentype");
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getOpentype() {
		return opentype;
	}

	public void setOpentype(String opentype) {
		this.opentype = opentype;
	}
	
	public List<MenuBean> getChildren() {
		return children;
	}

	public void setChildren(List<MenuBean> children) {
		this.children = children;
	}

	public void addChild(MenuBean menu) {
		this.children.add(menu);
	}

	@Override
	public String toString(){
		return JsonKit.toJson(this, 4);
	}
	
}
